package com.huaweicloud.sdk.secmaster.v1.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Objects;
import java.util.function.Consumer;

/**
 * Malware
 */
public class Malware {

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "name")

    private String name;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "sha256")

    private String sha256;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "type")

    private String type;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "path")

    private String path;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "state")

    private String state;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "properties")

    private MalwareProperties properties;

    public Malware withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * 恶意软件名称，最大64个字符。
     * @return name
     */
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Malware withSha256(String sha256) {
        this.sha256 = sha256;
        return this;
    }

    /**
     * 恶意软件sha256
     * @return sha256
     */
    public String getSha256() {
        return sha256;
    }

    public void setSha256(String sha256) {
        this.sha256 = sha256;
    }

    public Malware withType(String type) {
        this.type = type;
        return this;
    }

    /**
     * 恶意软件类型，遵循STIX规范： adware、backdoor、bot、bootkit、ddos、downloader、dropper、exploit-kit、keylogger、ransomware、remote-access-trojan、resource-exploitation、rogue-security-software、rootkit、screen-capture、spyware、trojan、unknown、virus、webshell、wiper、worm
     * @return type
     */
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Malware withPath(String path) {
        this.path = path;
        return this;
    }

    /**
     * 恶意软件在系统中的路径，最大512个字符。
     * @return path
     */
    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public Malware withState(String state) {
        this.state = state;
        return this;
    }

    /**
     * 恶意软件状态，取值范围：OBSERVED、REMOVAL_FAILED、REMOVED。
     * @return state
     */
    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public Malware withProperties(MalwareProperties properties) {
        this.properties = properties;
        return this;
    }

    public Malware withProperties(Consumer<MalwareProperties> propertiesSetter) {
        if (this.properties == null) {
            this.properties = new MalwareProperties();
            propertiesSetter.accept(this.properties);
        }

        return this;
    }

    /**
     * Get properties
     * @return properties
     */
    public MalwareProperties getProperties() {
        return properties;
    }

    public void setProperties(MalwareProperties properties) {
        this.properties = properties;
    }

    @Override
    public boolean equals(java.lang.Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        Malware that = (Malware) obj;
        return Objects.equals(this.name, that.name) && Objects.equals(this.sha256, that.sha256)
            && Objects.equals(this.type, that.type) && Objects.equals(this.path, that.path)
            && Objects.equals(this.state, that.state) && Objects.equals(this.properties, that.properties);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, sha256, type, path, state, properties);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class Malware {\n");
        sb.append("    name: ").append(toIndentedString(name)).append("\n");
        sb.append("    sha256: ").append(toIndentedString(sha256)).append("\n");
        sb.append("    type: ").append(toIndentedString(type)).append("\n");
        sb.append("    path: ").append(toIndentedString(path)).append("\n");
        sb.append("    state: ").append(toIndentedString(state)).append("\n");
        sb.append("    properties: ").append(toIndentedString(properties)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(java.lang.Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }

}
